{include file = $smarty.const.APPLICATION_PATH|cat:"/application/views/header.html"}
{literal}
<script type="text/javascript">
    $(function(){
        $('.assortment').hover(function(){
            $('.assort_list').stop().fadeIn();
        },function(){
            $('.assort_list').stop().fadeOut();
        });
    });
</script>
<script type="text/javascript" src="/js/uploadPreview.min.js"></script>
<script type="text/javascript" src="/js/user.js"></script>
<script>
    window.onload = function () {
        new uploadPreview({ UpBtn: "b_certificate", DivShow: "bimg", ImgShow: "bimgShow" });
        new uploadPreview({ UpBtn: "tr_certificate", DivShow: "trimg", ImgShow: "trbimgShow" });
        new uploadPreview({ UpBtn: "oc_certificate", DivShow: "ocimg", ImgShow: "ocimgShow" });
    }

    $(function () {
        $(".save_licenses").on("click",function(e){
            e.preventDefault()
            var business_id = $("#business_id").val();
            var b_certificate = $("#b_certificate").val();
            var tr_certificate = $("#tr_certificate").val();
            var oc_certificate = $("#oc_certificate").val();
            if(!business_id || business_id==''){
                alert("亲，你没有公司信息哦,无法操作！"); return false;
            }
//            if(!b_certificate || b_certificate==''){
//                alert("亲，请填写营业执照！"); return false;
//            }
//
//            if(!tr_certificate || tr_certificate==''){
//                alert("亲，请填写税务登记证！"); return false;
//            }
//            if(!oc_certificate || oc_certificate==''){
//                alert("亲，请填写组织机构代码证！"); return false;
//            }
            $('#myform').submit();
        })
    });

    $(function () {
        $("#b_certificate").change(function(){
            var file = $(this).val();
            var fileName = getFileName(file);
            if(fileName==''){
                fileName='请选择需要上传图片';
            }
            $(this).closest("li").find(".pfspan").html(fileName);
        });

        $("#tr_certificate").change(function(){
            var file = $(this).val();
            var fileName = getFileName(file);
            if(fileName==''){
                fileName='请选择需要上传图片';
            }
            $(this).closest("li").find(".pfspan").html(fileName);
        });

        $("#oc_certificate").change(function(){
            var file = $(this).val();
            var fileName = getFileName(file);
            if(fileName==''){
                fileName='请选择需要上传图片';
            }
            $(this).closest("li").find(".pfspan").html(fileName);
        });

        function getFileName(o){
            var pos=o.lastIndexOf("\\");
            return o.substring(pos+1);
        }
    });
</script>
<style>
    .assort_list{display: none;}
</style>
{/literal}
<div class="help_center">

<div class="crumbs_tmg" style="padding-top:0;">当前位置：<a href="#">首页</a><i class="ffs">></i><a href="#">会员中心</a><i class="ffs">></i><span class="blue">公司认证</span></div>

    {include file = $smarty.const.APPLICATION_PATH|cat:"/application/views/menu_title.html"}
    <form id="myform" action="/user/savelicenses" method="post" enctype="multipart/form-data">
    <div class="user_content">
    	<h3 class="user_title">
        	<ul>
            	<li class="curr">公司认证</li>
            </ul>
        </h3>
        
        
        <div class="receiving_address">
        	<ul class="company_certification">
            	<li class="gray" style="padding-left:50px;">温馨提示：三证上传仅支持文件类型为:jpg、jpeg、png、gif、bmp，最大不超过5M。</li>
                <li><span class="fl mt5">　　　<i class="orange">*</i>公司名称： </span>
                    <div class="popup_se w295">
                        <label></label>
                        <div class="popup_semg">
                            <select name="business_id" id="business_id">
                                {if !$Business_info}
                                <option value="0">请选择...</option>
                                {else}
                                {foreach from=$Business_info key=key item=item}
                                <option value="{$item.business_id}">{$item.business_name}</option>
                                {/foreach}
                                {/if}
                            </select>
                        </div>
                    </div>
                </li>
                <li><span class="fl mt5">　　　<i class="orange">*</i>营业执照：</span>
                    <div class="popup_file">
                        <span class="pfspan"></span>
                    </div>
                    <div class="pupup_file_fd"><input name="b_certificate" type="file" id="b_certificate" /><span class="ppfile_btn b_certificate">选择文件</span></div>
                	<!--<div class="popup_files"><input name="b_certificate" type="file" id="b_certificate" /></div>-->
                    <!--<input type="button" class="ppfile_btn2 b_certificate" value="选择文件"/>-->
                    <div class="pl118" style="padding-top:50px;" id="bimg">
                        {if !$certificate['b_certificate']}
                    	<img src="/images/temp/s_01.jpg" id="bimgShow" width="300" height="150" />
                        {else}
                        <img src="/upload/{$certificate['b_certificate']}" id="bimgShow" width="300" height="150" />
                        {/if}
                    </div>
                </li>
                 <li><span class="fl mt5">　　<i class="orange">*</i>税务登记证：</span>

                     <div class="popup_file">
                         <span class="pfspan"></span>
                     </div>
                     <div class="pupup_file_fd"><input name="tr_certificate" type="file" id="tr_certificate"  /><span class="ppfile_btn tr_certificate">选择文件</span></div>
                	<!--<div class="popup_files"><input name="tr_certificate" type="file" id="tr_certificate"  /></div>-->
                    <!--<input type="button" class="ppfile_btn2 tr_certificate" value="选择文件"/>-->
                    <div class="pl118" style="padding-top:50px;" id="trimg">
                        {if !$certificate['tr_certificate']}
                    	<img src="/images/temp/s_02.jpg" id="trbimgShow" width="300" height="150" />
                        {else}
                        <img src="/upload/{$certificate['tr_certificate']}" id="trbimgShow" width="300" height="150" />
                        {/if}
                    </div>
                </li>
                <li><span class="fl mt5"><i class="orange">*</i>组织机构代码证：</span>
                    <div class="popup_file">
                        <span class="pfspan"></span>
                    </div>
                    <div class="pupup_file_fd"><input name="oc_certificate" type="file" id="oc_certificate"  /><span class="ppfile_btn oc_certificate">选择文件</span></div>

                	<!--<div class="popup_files"><input name="oc_certificate" type="file" id="oc_certificate"  /></div>-->
                    <!--<input type="button" class="ppfile_btn2 oc_certificate" value="选择文件"/>-->
                    <div class="pl118" style="padding-top:50px;" id="ocimg">
                        {if !$certificate['oc_certificate']}
                    	<img src="/images/temp/s_03.jpg" id="ocimgShow" width="300" height="150" />
                        {else}
                        <img src="/upload/{$certificate['oc_certificate']}" id="ocimgShow" width="300" height="150" />
                        {/if}
                    </div>
                </li>
                
                <li class="ml120"><input type="submit" class="ppfile_btn1 save_licenses" value="保   存"/></li>
                
            </ul>
        </div>
        
    </div>
    </form>
</div>




{include file = $smarty.const.APPLICATION_PATH|cat:"/application/views/footer.html"}
